package com.hbnu.boot;

import com.hbnu.boot.bean.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Boot303DemoApplication {

    public static void main(String[] args) {
        //Java10新特性：局部变量的自动推断
        var ioc = SpringApplication.run(Boot303DemoApplication.class, args);
        /*for (String name : ioc.getBeanDefinitionNames()) {
            System.out.println(name);
        }*/
//        getBeanNamesForType用于获取指定类型的所有 bean 的名称。
/*        for (String s : ioc.getBeanNamesForType(Cat.class)) {
            System.out.println("cat:" + s);
        }
        for (String s : ioc.getBeanNamesForType(Dog.class)) {
            System.out.println("dog:" + s);
        }
        for (String s : ioc.getBeanNamesForType(User.class)) {
            System.out.println("user:"+s);
        }*/
//        Pig pig = ioc.getBean(Pig.class);
//        System.out.println(pig);
//        Sheep sheep = ioc.getBean(Sheep.class);
//        System.out.println(sheep);
        Person person = ioc.getBean(Person.class);
        System.out.println(person);

    }

}
